/*
 * $Id: ShemReaderFactory.java,v 1.2 2009/07/10 20:02:16 navdeep_mahajan Exp $
 * 
 * Copyright (C) 2008 General Electric Company. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of the General
 * Electric Company (GE). You shall not disclose this software and shall use it
 * only in accordance with the terms of the license agreement you entered into
 * with GE.
 * 
 * GE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
 * NON-INFRINGEMENT. GE SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
 * AS A RESULT OF USING, MODIFYING, OR DISTRIBUTING THIS SOFTWARE OR ITS
 * DERIVATIVES.
 */
package com.ge.healthcare.autosc.processor.shemjob.reader;

import com.ge.healthcare.autosc.processor.exception.ShemReaderFactoryException;

public class ShemReaderFactory {

	public static ShemTextReader getDataSetReader(String readerName) 
		throws ShemReaderFactoryException {
		String msg = "Failed creating dataset reader " + readerName;
		ShemTextReader reader = null;
		Class<?> readerClass = null;
		try {
			readerClass = Class.forName(readerName);
			reader = (ShemTextReader)readerClass.newInstance();
		} catch (ClassNotFoundException cnfe) {
			throw new ShemReaderFactoryException(msg, cnfe);
		} catch (InstantiationException ie) {
			throw new ShemReaderFactoryException(msg, ie);
		} catch (IllegalAccessException iae) {
			throw new ShemReaderFactoryException(msg, iae);
		}
		return reader;
	}
}
